diff options
author | James Y Knight <jyknight@google.com> | 2015-08-05 16:57:36 +0000 |
---|---|---|
committer | James Y Knight <jyknight@google.com> | 2015-08-05 16:57:36 +0000 |
commit | 81167fb799a8dd8378c2824f6fb65264403976e7 (patch) | |
tree | 4d6b8d1f67515d042297f74844dacbcea4ce80de /clang/test | |
parent | 95f0606e6210ba034001b65f496e718274d20094 (diff) | |
download | bcm5719-llvm-81167fb799a8dd8378c2824f6fb65264403976e7.tar.gz bcm5719-llvm-81167fb799a8dd8378c2824f6fb65264403976e7.zip |
Add missing atomic libcall support.
Support for emitting libcalls for __atomic_fetch_nand and
__atomic_{add,sub,and,or,xor,nand}_fetch was missing; add it, and some
test cases.
Differential Revision: http://reviews.llvm.org/D10847
llvm-svn: 244063
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CodeGen/atomic-ops-libcall.c | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/clang/test/CodeGen/atomic-ops-libcall.c b/clang/test/CodeGen/atomic-ops-libcall.c index e55a1bd1eae..5b9ba467d81 100644 --- a/clang/test/CodeGen/atomic-ops-libcall.c +++ b/clang/test/CodeGen/atomic-ops-libcall.c @@ -35,3 +35,75 @@ int *fp2a(int **p) { // Note, the GNU builtins do not multiply by sizeof(T)! return __atomic_fetch_sub(p, 4, memory_order_relaxed); } + +int test_atomic_fetch_add(int *p) { + // CHECK: test_atomic_fetch_add + // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_fetch_add_4(i8* {{%[0-9]+}}, i32 55, i32 5) + return __atomic_fetch_add(p, 55, memory_order_seq_cst); +} + +int test_atomic_fetch_sub(int *p) { + // CHECK: test_atomic_fetch_sub + // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_fetch_sub_4(i8* {{%[0-9]+}}, i32 55, i32 5) + return __atomic_fetch_sub(p, 55, memory_order_seq_cst); +} + +int test_atomic_fetch_and(int *p) { + // CHECK: test_atomic_fetch_and + // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_fetch_and_4(i8* {{%[0-9]+}}, i32 55, i32 5) + return __atomic_fetch_and(p, 55, memory_order_seq_cst); +} + +int test_atomic_fetch_or(int *p) { + // CHECK: test_atomic_fetch_or + // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_fetch_or_4(i8* {{%[0-9]+}}, i32 55, i32 5) + return __atomic_fetch_or(p, 55, memory_order_seq_cst); +} + +int test_atomic_fetch_xor(int *p) { + // CHECK: test_atomic_fetch_xor + // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_fetch_xor_4(i8* {{%[0-9]+}}, i32 55, i32 5) + return __atomic_fetch_xor(p, 55, memory_order_seq_cst); +} + +int test_atomic_fetch_nand(int *p) { + // CHECK: test_atomic_fetch_nand + // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_fetch_nand_4(i8* {{%[0-9]+}}, i32 55, i32 5) + return __atomic_fetch_nand(p, 55, memory_order_seq_cst); +} + +int test_atomic_add_fetch(int *p) { + // CHECK: test_atomic_add_fetch + // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_add_fetch_4(i8* {{%[0-9]+}}, i32 55, i32 5) + return __atomic_add_fetch(p, 55, memory_order_seq_cst); +} + +int test_atomic_sub_fetch(int *p) { + // CHECK: test_atomic_sub_fetch + // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_sub_fetch_4(i8* {{%[0-9]+}}, i32 55, i32 5) + return __atomic_sub_fetch(p, 55, memory_order_seq_cst); +} + +int test_atomic_and_fetch(int *p) { + // CHECK: test_atomic_and_fetch + // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_and_fetch_4(i8* {{%[0-9]+}}, i32 55, i32 5) + return __atomic_and_fetch(p, 55, memory_order_seq_cst); +} + +int test_atomic_or_fetch(int *p) { + // CHECK: test_atomic_or_fetch + // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_or_fetch_4(i8* {{%[0-9]+}}, i32 55, i32 5) + return __atomic_or_fetch(p, 55, memory_order_seq_cst); +} + +int test_atomic_xor_fetch(int *p) { + // CHECK: test_atomic_xor_fetch + // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_xor_fetch_4(i8* {{%[0-9]+}}, i32 55, i32 5) + return __atomic_xor_fetch(p, 55, memory_order_seq_cst); +} + +int test_atomic_nand_fetch(int *p) { + // CHECK: test_atomic_nand_fetch + // CHECK: {{%[^ ]*}} = tail call i32 @__atomic_nand_fetch_4(i8* {{%[0-9]+}}, i32 55, i32 5) + return __atomic_nand_fetch(p, 55, memory_order_seq_cst); +} |