1 // RUN: %clang_cc1 -triple x86_64-apple-darwin -Wno-int-conversion %s -emit-llvm -o - | FileCheck %s
3 int* foo(int** a
, int* b
, int* c
) {
4 return __sync_val_compare_and_swap (a
, b
, c
);
6 // CHECK-LABEL: define{{.*}} ptr @foo
7 // CHECK: cmpxchg {{.*}}, align 8
9 int foo2(int** a
, int* b
, int* c
) {
10 return __sync_bool_compare_and_swap (a
, b
, c
);
12 // CHECK-LABEL: define{{.*}} i32 @foo2
13 // CHECK: cmpxchg {{.*}}, align 8
15 int* foo3(int** a
, int b
) {
16 return __sync_fetch_and_add (a
, b
);
18 // CHECK-LABEL: define{{.*}} ptr @foo3
19 // CHECK: atomicrmw add {{.*}}, align 8
22 int* foo4(int** a
, int b
) {
23 return __sync_fetch_and_sub (a
, b
);
25 // CHECK-LABEL: define{{.*}} ptr @foo4
26 // CHECK: atomicrmw sub {{.*}}, align 8
29 int* foo5(int** a
, int* b
) {
30 return __sync_lock_test_and_set (a
, b
);
32 // CHECK-LABEL: define{{.*}} ptr @foo5
33 // CHECK: atomicrmw xchg {{.*}}, align 8
36 int* foo6(int** a
, int*** b
) {
37 return __sync_lock_test_and_set (a
, b
);
39 // CHECK-LABEL: define{{.*}} ptr @foo6
40 // CHECK: atomicrmw xchg {{.*}}, align 8