41 lines · c
1// RUN: %clang_cc1 -triple x86_64-apple-darwin -Wno-int-conversion %s -emit-llvm -o - | FileCheck %s2 3int* foo(int** a, int* b, int* c) {4return __sync_val_compare_and_swap (a, b, c);5}6// CHECK-LABEL: define{{.*}} ptr @foo7// CHECK: cmpxchg {{.*}}, align 88 9int foo2(int** a, int* b, int* c) {10return __sync_bool_compare_and_swap (a, b, c);11}12// CHECK-LABEL: define{{.*}} i32 @foo213// CHECK: cmpxchg {{.*}}, align 814 15int* foo3(int** a, int b) {16 return __sync_fetch_and_add (a, b);17}18// CHECK-LABEL: define{{.*}} ptr @foo319// CHECK: atomicrmw add {{.*}}, align 820 21 22int* foo4(int** a, int b) {23 return __sync_fetch_and_sub (a, b);24}25// CHECK-LABEL: define{{.*}} ptr @foo426// CHECK: atomicrmw sub {{.*}}, align 827 28 29int* foo5(int** a, int* b) {30 return __sync_lock_test_and_set (a, b);31}32// CHECK-LABEL: define{{.*}} ptr @foo533// CHECK: atomicrmw xchg {{.*}}, align 834 35 36int* foo6(int** a, int*** b) {37 return __sync_lock_test_and_set (a, (int*)b);38}39// CHECK-LABEL: define{{.*}} ptr @foo640// CHECK: atomicrmw xchg {{.*}}, align 841