aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Basic/Builtins.def
AgeCommit message (Collapse)Author
2013-08-01Add the __nacl_atomic_is_lock_free builtinJF Bastien
This is part of a bigger CL to fix C++11 in PNaCl, to commit in the following order: - https://codereview.chromium.org/20552002 - https://codereview.chromium.org/20554002 - https://codereview.chromium.org/20560002 - https://codereview.chromium.org/20561002 This change is needed in Clang so that it can recognize the builtin and translate it to the intrinsic that 20554002 adds. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3475 TEST= ./scons run_synchronization_cpp11_test --verbose bitcode=1 platform=x86-64 R=dschuff@chromium.org Review URL: https://codereview.chromium.org/20552002
2013-01-17Some builtins do not evaluate their arguments. Teach EvaluatedExprVisitor notRichard Smith
to visit them. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172769 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-14Multiprecision subtraction builtins.Michael Gottesman
We lower these into 2x chained usub.with.overflow intrinsics. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172476 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-13Added builtins for multiprecision adds.Michael Gottesman
We lower all of these intrinsics into a 2x chained usage of uadd.with.overflow. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172341 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-04Fix up various builtin declaration of objc_msgSend familiesFariborz Jahanian
to match those foung in objc.h an avoid spurious warnings. // rdar://12489098 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171492 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-18CodeGen: Expand creal and cimag into complex field loadsMeador Inge
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170455 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-18Use the correct return type (size_t) for these builtins.Bill Wendling
<rdar://problem/12646344> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170393 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-18Add an expected parameter for the size of the destination.Bill Wendling
<rdar://problem/12622659> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170392 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27Fix the definition of the vfork() builtin on Haiku. PR14378.Eli Friedman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168674 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-19remove noreturn attribute from __builtin_debugtrapShuxin Yang
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166345 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-19add __builtin_debugtrapShuxin Yang
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166298 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-06Expose __builtin_bswap16.Benjamin Kramer
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165362 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-22Make ceil/floor/nearbyint/rint/round const even with -fmath-errno.Benjamin Kramer
The conditions described by POSIX can never happen with IEEE-754 floats. When the function is const we can emit a single sse4.1 instruction for it, without losing anything :) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162379 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-22Math builtin definition tweaks.Benjamin Kramer
There were missed optimizations when the system headers didn't have attributes in place, specifically: - Add copysign, exp2, log2, nearbyint, rint and trunc to the list. These are functions that get inlined by LLVM's optimizer, but only when they have the right attributes. - Mark copysign, fabs, fmax, fmin and trunc const unconditionally. Previously these were only const with -fno-math-errno, but they never set errno per POSIX. For ceil/floor/nearbyint/round I'm not aware of any implementation that sets errno, but POSIX says it may signal overflow so I left them alone for now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162375 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-17Define __builtin_ffs[ll] with a signed argument instead of unsigned.Benjamin Kramer
GCC documents these as unsigned, but defines them as signed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162106 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-05Add __builtin_readcyclecounter() to produce the @llvm.readcyclecounter() ↵Hal Finkel
intrinsic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161310 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-07Add ext_vector type code for builtins, from John Garvin!Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158156 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-08Fix fmin*/fmax* library builtin signatures.Douglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156396 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-01Fix compilation with mingw-w64.Abramo Bagnara
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155904 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-28Currently __builtin_annotation() only annotates an i32.Julien Lerouge
i32 __builtin_annotation(i32, string); Applying it to i64 (e.g., long long) generates the following IR. trunc i64 {{.*}} to i32 call i32 @llvm.annotation.i32 zext i32 {{.*}} to i64 The redundant truncation and extension make the result difficult to use. This patch makes __builtin_annotation() generic. type __builtin_annotation(type, string); For the i64 example, it simplifies the generated IR to: call i64 @llvm.annotation.i64 Patch by Xi Wang! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155764 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-24Add acos, asin, ceil, fabs, floor, fmax, fmin, round, and tan to the builtinChad Rosier
math library functions. rdar://11251464 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155502 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-24Add atan, atan2, exp, and log to the builtin math library functions.Chad Rosier
With -fno-math-errno (the default for Darwin) or -ffast-math these library function can be marked readnone enabling more opportunities for CSE and other optimizations. rdar://11251464 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155498 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-24Alphabetize the builtin math library functions. No functional change intended.Chad Rosier
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155492 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-13Implement __atomic_fetch_nand and __atomic_nand_fetch to complete our set ofRichard Smith
GNU __atomic builtins. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154659 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-13Implement the missing pieces needed to support libstdc++4.7's <atomic>:Richard Smith
__atomic_test_and_set, __atomic_clear, plus a pile of undocumented __GCC_* predefined macros. Implement library fallback for __atomic_is_lock_free and __c11_atomic_is_lock_free, and implement __atomic_always_lock_free. Contrary to their documentation, GCC's __atomic_fetch_add family don't multiply the operand by sizeof(T) when operating on a pointer type. libstdc++ relies on this quirk. Remove this handling for all but the __c11_atomic_fetch_add and __c11_atomic_fetch_sub builtins. Contrary to their documentation, __atomic_test_and_set and __atomic_clear take a first argument of type 'volatile void *', not 'void *' or 'bool *', and __atomic_is_lock_free and __atomic_always_lock_free have an argument of type 'const volatile void *', not 'void *'. With this change, libstdc++4.7's <atomic> passes libc++'s atomic test suite, except for a couple of libstdc++ bugs and some cases where libc++'s test suite tests for properties which implementations have latitude to vary. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154640 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-12Implement support for 18 of the GNU-compatible __atomic builtins.Richard Smith
This is not quite sufficient for libstdc++'s <atomic>: we still need __atomic_test_and_set and __atomic_clear, and may need a more complete __atomic_is_lock_free implementation. We are also missing an implementation of __atomic_always_lock_free, __atomic_nand_fetch, and __atomic_fetch_nand, but those aren't needed for libstdc++. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154579 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-11Provide, and document, a set of __c11_atomic_* intrinsics to implement C11'sRichard Smith
<stdatomic.h> header. In passing, fix LanguageExtensions to note that C11 and C++11 are no longer "upcoming standards" but are now actually standardized. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154513 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-15It was pointed out that a checking version of strdup isn't needed. So much ↵Bill Wendling
for late-night hacking. :) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152838 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-15Add the object size checking support for a few other builtins.Bill Wendling
The functions memccpy, strdup, strndup, strlcat, and strlcpy should also have object size checking support. Of course, this is only good if the C library also supports these functions. <rdar://problem/10528974> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152789 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-28Make the __builtin_c[lt]zs builtins target independent.Benjamin Kramer
There is really no reason to have these only available on x86. It's just __builtin_c[tl]z for shorts. Modernize the test while at it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149183 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-24Replace a hack to handle NSLog/NSLogv in sema by declaring them as Library ↵Jean-Daniel Dupas
Builtins. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148873 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-24Remove trailing slash in front of header name of ObjC builtins.Jean-Daniel Dupas
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148872 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20Add ability to specifiy 'restrict' on parameters of builtins, and correct ↵Ted Kremenek
this oversight for scanf functions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148573 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17Add __builtin_labs and __builtin_llabs, to complete the set of ↵Eli Friedman
__builtin_*abs. Patch by Ruben Van Boxem. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148340 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17Use Builtin ID as the return valueAnna Zaks
for FunctionDecl::getMemoryFunctionKind(). This is a follow up on the Chris's review for r148142: We don't want to pollute FunctionDecl with an extra enum. (To make this work, added memcmp and family to the library builtins.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148267 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-16Some improvements to the handling of C11 atomic types:David Chisnall
- Add atomic-to/from-nonatomic cast types - Emit atomic operations for arithmetic on atomic types - Emit non-atomic stores for initialisation of atomic types, but atomic stores and loads for every other store / load - Add a __atomic_init() intrinsic which does a non-atomic store to an _Atomic() type. This is needed for the corresponding C11 stdatomic.h function. - Enables the relevant __has_feature() checks. The feature isn't 100% complete yet, but it's done enough that we want people testing it. Still to do: - Make the arithmetic operations on atomic types (e.g. Atomic(int) foo = 1; foo++;) use the correct LLVM intrinsic if one exists, not a loop with a cmpxchg. - Add a signal fence builtin - Properly set the fenv state in atomic operations on floating point values - Correctly handle things like _Atomic(_Complex double) which are too large for an atomic cmpxchg on some platforms (this requires working out what 'correctly' means in this context) - Fix the many remaining corner cases git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148242 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12Fix signature of vsscanf in Builtins.defHans Wennborg
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146392 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12Fix signature of sscanf in Builtins.defHans Wennborg
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146390 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12Make fscanf, vscanf, etc. be recognized as scanf-like functions.Hans Wennborg
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146367 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-13Fix the signature of the getcontext builtin. Patch by Dimitry Andric.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144505 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-09Fix the signature of __sigsetjmp and sigsetjmp. Patch by Dimitry Andric.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144237 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-08Mark the overloaded atomic builtins as having custom type checking,Douglas Gregor
which they do. This avoids all of the default argument promotions that we (1) don't want, and (2) undo during that custom type checking, and makes sure that we don't run into trouble during template instantiation. Fixes PR11320. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144110 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-31In x86_64, when calling an Objective-C method that returns a _Complex long ↵Anders Carlsson
double, make sure to use the objc_msgSend_fp2ret function which ensures that the return value will be {0, 0} if the receiver is nil. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143350 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-19Fix the signatures of vfork, __sigsetjmp and sigsetjmp.Rafael Espindola
Patch by Dimitry Andric. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142531 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-17Initial implementation of __atomic_is_lock_free. The input is the size of ↵Eli Friedman
an atomic type rather than an atomic type itself just to save some implementation pain; I can change that if it seems worthwhile. I think this is the last hook needed for <atomic> besides defines for ATOMIC_CHAR_LOCK_FREE and friends. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142281 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-14vfork comes from unistd.hJoerg Sonnenberger
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142007 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-14Misc fixes for atomics. Biggest fix is doing alignment correctly for ↵Eli Friedman
_Atomic types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142002 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-12Fix MSVC build.Rafael Espindola
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141837 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-12Add returns_twice to functions that are known to return twice. This implementsRafael Espindola
the same behavior of gcc by keeping the attribute out of the function type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141803 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-11Initial implementation of __atomic_* (everything except __atomic_is_lock_free).Eli Friedman
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141632 91177308-0d34-0410-b5e6-96231b3b80d8