summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGBuiltin.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Add target hook CodeGen queries when generating builtin pow*.Eli Bendersky2013-07-031-7/+12
| | | | | | | | | | | Without fmath-errno, Clang currently generates calls to @llvm.pow.* intrinsics when it sees pow*(). This may not be suitable for all targets (for example le32/PNaCl), so the attached patch adds a target hook that CodeGen queries. The target can state its preference for having or not having the intrinsic generated. Non-PNaCl behavior remains unchanged; PNaCl-specific test added. llvm-svn: 185568
* Remove misplaced commentEli Bendersky2013-06-251-1/+0
| | | | llvm-svn: 184862
* [checked-arithmetic builtins] Added builtins to enable users to perform ↵Michael Gottesman2013-06-201-0/+71
| | | | | | | | | | | | | checked-arithmetic in c. This will enable users in security critical applications to perform checked-arithmetic in a fast safe manner that is amenable to c. Tests/an update to Language Extensions is included as well. rdar://13421498. llvm-svn: 184497
* [multiprecision-builtins] Added missing builtin __builtin_{add,sub}cb for ↵Michael Gottesman2013-06-181-0/+4
| | | | | | | | | | | | | | {add,sub} with carry for bytes. I have had several people ask me about why this builtin was not available in clang (since it seems like a logical conclusion). This patch implements said builtins. Relevant tests are included as well. I also updated the Clang language extension reference. rdar://14192664. llvm-svn: 184227
* Fix __clear_cache on ARM.Rafael Espindola2013-05-141-3/+2
| | | | | | | | | | Current gcc's produce an error if __clear_cache is anything but __clear_cache(char *a, char *b); It looks like we had just implemented a gcc bug that is now fixed. llvm-svn: 181784
* Revert accidental commit.Benjamin Kramer2013-05-141-3/+1
| | | | llvm-svn: 181782
* Take a stab at trying to unbreak the makefile build.Benjamin Kramer2013-05-141-1/+3
| | | | | | There is no clangRewrite.a. llvm-svn: 181781
* AArch64: teach Clang about __clear_cache intrinsicTim Northover2013-05-041-0/+21
| | | | | | | libgcc provides a __clear_cache intrinsic on AArch64, much like it does on 32-bit ARM. llvm-svn: 181111
* Standardize accesses to the TargetInfo in IR-gen.John McCall2013-04-161-5/+5
| | | | | | Patch by Stephen Lin! llvm-svn: 179638
* Add RDSEED intrinsic support defined in AVX2 extensionMichael Liao2013-03-291-1/+13
| | | | llvm-svn: 178331
* Change hasAggregateLLVMType, which conflates complex andJohn McCall2013-03-071-3/+1
| | | | | | | | | | | | | | | aggregate types in a profoundly wrong way that has to be worked around in every call site, to getEvaluationKind, which classifies and distinguishes between all of these cases. Also, normalize the API for loading and storing complexes. I'm working on a larger patch and wanted to pull these changes out, but it would have be annoying to detangle them from each other. llvm-svn: 176656
* Use the actual ABI-determined C calling convention for runtimeJohn McCall2013-02-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | calls and declarations. LLVM has a default CC determined by the target triple. This is not always the actual default CC for the ABI we've been asked to target, and so we sometimes find ourselves annotating all user functions with an explicit calling convention. Since these calling conventions usually agree for the simple set of argument types passed to most runtime functions, using the LLVM-default CC in principle has no effect. However, the LLVM optimizer goes into histrionics if it sees this kind of formal CC mismatch, since it has no concept of CC compatibility. Therefore, if this module happens to define the "runtime" function, or got LTO'ed with such a definition, we can miscompile; so it's quite important to get this right. Defining runtime functions locally is quite common in embedded applications. llvm-svn: 176286
* [ubsan] Add support for -fsanitize-blacklistWill Dietz2013-01-181-1/+1
| | | | llvm-svn: 172808
* Correct order of operands forwarding NEON vfma to LLVM fmaTim Northover2013-01-161-1/+3
| | | | llvm-svn: 172650
* Multiprecision subtraction builtins.Michael Gottesman2013-01-141-2/+22
| | | | | | We lower these into 2x chained usub.with.overflow intrinsics. llvm-svn: 172476
* CGBuiltin.cpp: Fix abuse of ArrayRef in EmitOverflowIntrinsic().NAKAMURA Takumi2013-01-131-2/+1
| | | | | | | | | | | | | | | | | | | | In ArrayRef<T>(X), X should not be temporary value. It could be rewritten more redundantly; llvm::Type *XTy = X->getType(); ArrayRef<llvm::Type *> Ty(XTy); llvm::Value *Callee = CGF.CGM.getIntrinsic(IntrinsicID, Ty); Since it is safe if both XTy and Ty are temporary value in one statement, it could be shorten; llvm::Value *Callee = CGF.CGM.getIntrinsic(IntrinsicID, ArrayRef<llvm::Type*>(X->getType())); ArrayRef<T> has an implicit constructor to create uni-entry of T; llvm::Value *Callee = CGF.CGM.getIntrinsic(IntrinsicID, X->getType()); MSVC-generated clang.exe crashed. llvm-svn: 172352
* Added builtins for multiprecision adds.Michael Gottesman2013-01-131-0/+70
| | | | | | | We lower all of these intrinsics into a 2x chained usage of uadd.with.overflow. llvm-svn: 172341
* Remove useless 'llvm::' qualifier from names like StringRef and others that areDmitri Gribenko2013-01-121-2/+2
| | | | | | brought into 'clang' namespace by clang/Basic/LLVM.h llvm-svn: 172323
* Rewrite #includes for llvm/Foo.h to llvm/IR/Foo.h as appropriate toChandler Carruth2013-01-021-2/+2
| | | | | | | | reflect the migration in r171366. Re-sort the #include lines to reflect the new paths. llvm-svn: 171369
* CodeGen: Expand creal and cimag into complex field loadsMeador Inge2012-12-181-2/+8
| | | | | | | | | | | | | | | PR 14529 was opened because neither Clang or LLVM was expanding calls to creal* or cimag* into instructions that just load the respective complex field. After some discussion, it was not considered realistic to do this in LLVM because of the platform specific way complex types are expanded. Thus a way to solve this in Clang was pursued. GCC does a similar expansion. This patch adds the feature to Clang by making the creal* and cimag* functions library builtins and modifying the builtin code generator to look for the new builtin types. llvm-svn: 170455
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-4/+4
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* [ubsan] Add flag to enable recovery from checks when possible.Will Dietz2012-12-021-1/+1
| | | | llvm-svn: 169114
* Use the individual -fsanitize=<...> arguments to control which of the UBSanRichard Smith2012-11-051-1/+1
| | | | | | | checks to enable. Remove frontend support for -fcatch-undefined-behavior, -faddress-sanitizer and -fthread-sanitizer now that they don't do anything. llvm-svn: 167413
* Cleanup some clang code to use new type functions instead of using cast<>.Micah Villmow2012-10-251-12/+6
| | | | llvm-svn: 166684
* "Implement" codegen support for __noop().Nico Weber2012-10-131-0/+2
| | | | | | | Eli discovered that __noop's sema behavior also needs some love. I filed PR14081 for that and intend to improve it. llvm-svn: 165886
* -fcatch-undefined-behavior: emit calls to the runtime library whenever one ↵Richard Smith2012-10-091-1/+3
| | | | | | of the checks fails. llvm-svn: 165536
* Move TargetData to DataLayout.Micah Villmow2012-10-081-1/+1
| | | | llvm-svn: 165395
* Expose __builtin_bswap16.Benjamin Kramer2012-10-061-0/+1
| | | | | | | GCC has always supported this on PowerPC and 4.8 supports it on all platforms, so it's a good idea to expose it in clang too. LLVM supports this on all targets. llvm-svn: 165362
* Add an FMA intrinsic for ARM Neon.Bob Wilson2012-09-291-0/+8
| | | | llvm-svn: 164904
* Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. ↵Sylvestre Ledru2012-09-271-3/+3
| | | | | | See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164766 llvm-svn: 164769
* Fix a typo 'iff' => 'if'Sylvestre Ledru2012-09-271-3/+3
| | | | llvm-svn: 164766
* Add codegen support for the __debugbreak intrinsic.Nico Weber2012-09-261-0/+4
| | | | llvm-svn: 164660
* ARM: Use a dedicated intrinsic for vector bitwise select.Jim Grosbach2012-09-211-0/+4
| | | | | | | | | | | The expression based expansion too often results in IR level optimizations splitting the intermediate values into separate basic blocks, preventing the formation of the VBSL instruction as the code author intended. In particular, LICM would often hoist part of the computation out of a loop. rdar://11011471 llvm-svn: 164342
* Tidy up. Trailing whitespace and 80 columns.Jim Grosbach2012-09-211-67/+69
| | | | llvm-svn: 164341
* -fcatch-undefined-behavior: Factor emission of the creation of, and branch to,Richard Smith2012-09-081-1/+1
| | | | | | | | | the trap BB out of the individual checks and into a common function, to prepare for making this code call into a runtime library. Rename the existing EmitCheck to EmitTypeCheck to clarify it and to move it out of the way of the new EmitCheck. llvm-svn: 163451
* Make alignment computation for pointer values for builtins handleEli Friedman2012-08-291-1/+2
| | | | | | non-pointer types with a pointer representation correctly. PR13660. llvm-svn: 162862
* Attempt to fix clang bootstrap (broken by r162425).Eli Friedman2012-08-231-2/+22
| | | | llvm-svn: 162440
* Use the alignment from lvalue emission to more accurately compute the alignmentEli Friedman2012-08-231-86/+144
| | | | | | | of a pointer for builtin emission, instead of just depending on the type of the pointee. <rdar://problem/11314941>. llvm-svn: 162425
* irgen: inline code for several of complex builtinFariborz Jahanian2012-08-141-0/+29
| | | | | | calls. // rdar://8315199 llvm-svn: 161891
* Avoid using i64 types for vld1q_lane/vst1q_lane intrinsics.Bob Wilson2012-08-141-4/+36
| | | | | | | | | The backend has to legalize i64 types by splitting them into two 32-bit pieces, which leads to poor quality code. If we produce code for these intrinsics that uses one-element vector types, which can live in Neon vector registers without getting split up, then the generated code is much better. Radar 11998303. llvm-svn: 161879
* Add __builtin_readcyclecounter() to produce the @llvm.readcyclecounter() ↵Hal Finkel2012-08-051-0/+4
| | | | | | intrinsic. llvm-svn: 161310
* More replacing of target-dependent intrinsics with target-indepdent Joel Jones2012-07-181-2/+3
| | | | | | | | | | | | | | | | | | | | | intrinsics. The second instruction(s) to be handled are the vector versions of count set bits (ctpop). The changes here are to clang so that it generates a target independent vector ctpop when it sees an ARM dependent vector bits set count. The changes in llvm are to match the target independent vector ctpop and in VMCore/AutoUpgrade.cpp to update any existing bc files containing ARM dependent vector pop counts with target-independent ctpops. There are also changes to an existing test case in llvm for ARM vector count instructions and to a test for the bitcode upgrade. <rdar://problem/11892519> There is deliberately no test for the change to clang, as so far as I know, no consensus has been reached regarding how to test neon instructions in clang; q.v. <rdar://problem/8762292> llvm-svn: 160409
* Revert commit r160308. We decide to move builtins selection to the backend.Simon Atanasyan2012-07-171-29/+0
| | | | llvm-svn: 160353
* MIPS: Implement __builtin_mips_shll_qb builtin function overloading.Simon Atanasyan2012-07-161-0/+29
| | | | | | | This function has two versions. The first one is used for a register operand. The second one is used for an immediate number. llvm-svn: 160308
* Capitalize comment.Eric Christopher2012-07-141-1/+1
| | | | llvm-svn: 160220
* This is one of the first steps at moving to replace target-dependent Joel Jones2012-07-131-1/+4
| | | | | | | | | | | | | | | | | | | | intrinsics with target-indepdent intrinsics. The first instruction(s) to be handled are the vector versions of count leading zeros (ctlz). The changes here are to clang so that it generates a target independent vector ctlz when it sees an ARM dependent vector ctlz. The changes in llvm are to match the target independent vector ctlz and in VMCore/AutoUpgrade.cpp to update any existing bc files containing ARM dependent vector ctlzs with target-independent ctlzs. There are also changes to an existing test case in llvm for ARM vector count instructions and a new test for the bitcode upgrade. <rdar://problem/11831778> There is deliberately no test for the change to clang, as so far as I know, no consensus has been reached regarding how to test neon instructions in clang; q.v. <rdar://problem/8762292> llvm-svn: 160201
* Add _rdrand{16,32,64}_step intrinsics to immintrin.hBenjamin Kramer2012-07-121-0/+21
| | | | llvm-svn: 160118
* Distinguish more carefully between free functions and C++ instance methodsJohn McCall2012-07-071-3/+3
| | | | | | | | in the ABI arrangement, and leave a hook behind so that we can easily tweak CCs on platforms that use different CCs by default for C++ instance methods. llvm-svn: 159894
* Dead code eliminate the massive hexagon builtin intrinsic supporting code.Benjamin Kramer2012-06-281-2584/+0
| | | | | | | | The tablegen'd code does the same thing without this egregious duplication. In my limited testing everything seems to work, however there can be differences if the clang and llvm builtin definitions don't match. llvm-svn: 159371
* Now that we use the GCC builtin <-> llvm intrinsic, dead code eliminate the ↵Benjamin Kramer2012-06-281-298/+0
| | | | | | | | handwritten emitter. The generated code uncovered an invalid prototype for __builtin_mips_shilo, fix it along the way. llvm-svn: 159368
OpenPOWER on IntegriCloud