summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/atomic.c
Commit message (Collapse)AuthorAgeFilesLines
* Add __sync_fetch_and_nand (again)Hal Finkel2014-10-021-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to GCC 4.4, __sync_fetch_and_nand was implemented as: { tmp = *ptr; *ptr = ~tmp & value; return tmp; } but this was changed in GCC 4.4 to be: { tmp = *ptr; *ptr = ~(tmp & value); return tmp; } in response to this change, support for sync_fetch_and_nand (and sync_nand_and_fetch) was removed in r99522 in order to avoid miscompiling code depending on the old semantics. However, at this point: 1. Many years have passed, and the amount of code relying on the old semantics is likely smaller. 2. Through the work of many contributors, all LLVM backends have been updated such that "atomicrmw nand" provides the newer GCC 4.4+ semantics (this process was complete July of 2014 (added to the release notes in r212635). 3. The lack of this intrinsic is now a needless impediment to porting codes from GCC to Clang (I've now seen several examples of this). It is true, however, that we still set GNUC_MINOR to 2 (corresponding to GCC 4.2). To compensate for this, and to address the original concern regarding code relying on the old semantics, I've added a warning that specifically details the fact that the semantics have changed and that we provide the newer semantics. Fixes PR8842. llvm-svn: 218905
* IR-change: cmpxchg operations now return { iN, i1 }.Tim Northover2014-06-131-5/+10
| | | | | | | | This is a minimal fix for clang. I'll soon add support for generating weak variants when requested, but that's not really necessary for the LLVM change in isolation. llvm-svn: 210907
* Don't try to create "store atomic" instructions of non-integer types; they ↵Eli Friedman2012-03-161-2/+6
| | | | | | aren't supported at the moment. PR12040. llvm-svn: 152891
* Re-commit r139643.Eli Friedman2011-09-131-4/+2
| | | | | | Make clang use Acquire loads and Release stores where necessary. llvm-svn: 139650
* Revert r139643 while I look into it; it's breaking selfhost.Eli Friedman2011-09-131-2/+4
| | | | llvm-svn: 139648
* Make clang use Acquire loads and Release stores where necessary.Eli Friedman2011-09-131-4/+2
| | | | llvm-svn: 139643
* Switch clang over to using fence/atomicrmw/cmpxchg instead of the intrinsics ↵Eli Friedman2011-09-071-80/+29
| | | | | | | | | | (which will go away). LLVM CodeGen does almost exactly the same thing with these and the old intrinsics, so I'm reasonably confident this will not break anything. There are still a few issues which need to be resolved with code generation for atomic load and store, so I'm not converting the places which need those for now. I'm not entirely sure what to do about __builtin_llvm_memory_barrier: the fence instruction doesn't expose all the possibilities which can be expressed by __builtin_llvm_memory_barrier. I would appreciate hearing from anyone who is using this intrinsic. llvm-svn: 139216
* Update clang tests for r137527.Eli Friedman2011-08-121-2/+2
| | | | llvm-svn: 137535
* add a __sync_swap builtin to fill out the rest of the __sync builtins. Chris Lattner2011-04-091-0/+5
| | | | | | Patch by Dave Zarzycki! llvm-svn: 129189
* Restore r117403 (fixing IR gen for bool atomics), this time being less John McCall2010-10-271-2/+1
| | | | | | | aggressive about the form we expect bools to be in. I don't really have time to fix all the sources right now. llvm-svn: 117486
* Revert r117403 as it caused PR8480.Rafael Espindola2010-10-271-1/+2
| | | | llvm-svn: 117456
* Extract procedures to do scalar-to-memory and memory-to-scalar conversionsJohn McCall2010-10-261-2/+1
| | | | | | | in IR gen, and use those to fix a correctness issue with bool atomic intrinsics. rdar://problem/8461234 llvm-svn: 117403
* fix the rest of rdar://8461279 - clang miscompiles address-space qualified ↵Chris Lattner2010-09-211-0/+8
| | | | | | atomics llvm-svn: 114503
* same bug as before, this time with __sync_val_compare_and_swap.Chris Lattner2010-09-211-1/+7
| | | | llvm-svn: 114502
* fix __sync_bool_compare_and_swap to work with address-space qualified types.Chris Lattner2010-09-211-0/+11
| | | | llvm-svn: 114498
* filecheckize.Chris Lattner2010-09-211-19/+87
| | | | llvm-svn: 114497
* Fix a goof in my previous patch -- not all of the builtins return a value, someChandler Carruth2010-07-181-3/+8
| | | | | | fixed return types. llvm-svn: 108657
* Improve the representation of the atomic builtins in a few ways. First, we makeChandler Carruth2010-07-181-1/+5
| | | | | | | | | | | | | | | their call expressions synthetically have the "deduced" types based on their first argument. We only insert conversions in the AST for arguments whose values require conversion to match the value type expected. This keeps PR7600 closed by maintaining the return type, but avoids assertions due to unexpected implicit casts making the type unsigned (test case added from Daniel). The magic is moved into the codegen for the atomic builtin which inserts the casts as needed at the IR level to raise the type to an integer suitable for the LLVM intrinsic. This shouldn't cause any real change in functionality, but now we can make the builtin be more truly polymorphic. llvm-svn: 108638
* Remove support for nand atomic builtins. They are inconsistently implemented inDaniel Dunbar2010-03-251-4/+2
| | | | | | | gcc, and the common expectation seems to be that they are unused. If and when someone cares we can add them back with well documented demantics. llvm-svn: 99522
* IRgen: Wrap atomic intrinsics with memory barriers, to ensure we honor the ↵Daniel Dunbar2010-03-201-0/+1
| | | | | | | | semantics. - This should be conservatively correct, we eventually should have target hooks for platforms that are less strict. llvm-svn: 99050
* Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.Daniel Dunbar2009-12-151-1/+1
| | | | | | | | | - This is designed to make it obvious that %clang_cc1 is a "test variable" which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it can be useful to redefine what gets run as 'clang -cc1' (for example, to set a default target). llvm-svn: 91446
* Eliminate &&s in tests.Daniel Dunbar2009-11-081-11/+11
| | | | | | - 'for i in $(find . -type f); do sed -e 's#\(RUN:.*[^ ]\) *&& *$#\1#g' $i | FileUpdate $i; done', for the curious. llvm-svn: 86430
* Fix a use-of-undefined, IRgen expects the RValue for "void" to be a scalar ↵Daniel Dunbar2009-05-271-1/+1
| | | | | | RValue. llvm-svn: 72504
* implement __sync_synchronize and __sync_lock_release,Chris Lattner2009-05-131-0/+6
| | | | | | rdar://6880573 llvm-svn: 71637
* force a target triple so that the right greppable output happens.Chris Lattner2009-05-091-1/+1
| | | | llvm-svn: 71361
* Fix the atomics sema code to convert operands to the argument typesChris Lattner2009-05-081-1/+4
| | | | | | | | | of the underlying _N builtin, not the the type of the pointee of the actual type. This ensures that atomics involving pointers end up using the correct integer type when they are resolved, avoiding aborts in codegen. llvm-svn: 71218
* reimplement __sync_* builtins to be variadic and to follow the sameChris Lattner2009-05-081-8/+9
| | | | | | | | | semantic rules that gcc and icc use. This implements the variadic and concrete versions as builtins and has sema do the disambiguation. There are probably a bunch of details to finish up but this seems like a large monotonic step forward :) llvm-svn: 71212
* Implement __sync_{add,sub,and,or,xor}_and_fetch andDaniel Dunbar2009-04-071-6/+14
| | | | | | | | __sync_bool_compare_and_swap. - <rdar://problem/6762223> [sema/irgen] support __sync_bool_compare_and_swap and __sync_add_and_fetch llvm-svn: 68482
* Rename clang to clang-cc.Daniel Dunbar2009-03-241-1/+1
| | | | | | Tests and drivers updated, still need to shuffle dirs. llvm-svn: 67602
* fix this testcase after Mon Ping's intrinsic rename.Chris Lattner2008-06-261-3/+3
| | | | llvm-svn: 52754
* Multiple tests in a single test file must be linked with '&&'.Argyrios Kyrtzidis2008-06-121-11/+11
| | | | | | Otherwise, failing tests other than the last one will not be reported. llvm-svn: 52231
* Added support to generate some atomic operators (add, sub, and, or etc..)Mon P Wang2008-05-091-0/+35
llvm-svn: 50919
OpenPOWER on IntegriCloud