2012-05-10 05:21:49 +08:00
|
|
|
// RUN: %clang_cc1 -triple x86_64-apple-darwin %s -emit-llvm -o - | FileCheck %s
|
2011-07-27 06:17:02 +08:00
|
|
|
|
|
|
|
int* foo(int** a, int* b, int* c) {
|
|
|
|
return __sync_val_compare_and_swap (a, b, c);
|
|
|
|
}
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} i32* @foo
|
2021-02-12 06:33:43 +08:00
|
|
|
// CHECK: cmpxchg {{.*}}, align 8
|
2011-07-27 06:17:02 +08:00
|
|
|
|
|
|
|
int foo2(int** a, int* b, int* c) {
|
|
|
|
return __sync_bool_compare_and_swap (a, b, c);
|
|
|
|
}
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} i32 @foo2
|
2021-02-12 06:33:43 +08:00
|
|
|
// CHECK: cmpxchg {{.*}}, align 8
|
2011-07-27 06:17:02 +08:00
|
|
|
|
|
|
|
int* foo3(int** a, int b) {
|
|
|
|
return __sync_fetch_and_add (a, b);
|
|
|
|
}
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} i32* @foo3
|
2021-02-12 06:33:43 +08:00
|
|
|
// CHECK: atomicrmw add {{.*}}, align 8
|
2011-09-07 09:41:24 +08:00
|
|
|
|
2011-07-27 06:17:02 +08:00
|
|
|
|
|
|
|
int* foo4(int** a, int b) {
|
|
|
|
return __sync_fetch_and_sub (a, b);
|
|
|
|
}
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} i32* @foo4
|
2021-02-12 06:33:43 +08:00
|
|
|
// CHECK: atomicrmw sub {{.*}}, align 8
|
2011-09-07 09:41:24 +08:00
|
|
|
|
2011-07-27 06:17:02 +08:00
|
|
|
|
|
|
|
int* foo5(int** a, int* b) {
|
|
|
|
return __sync_lock_test_and_set (a, b);
|
|
|
|
}
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} i32* @foo5
|
2021-02-12 06:33:43 +08:00
|
|
|
// CHECK: atomicrmw xchg {{.*}}, align 8
|
2011-09-07 09:41:24 +08:00
|
|
|
|
2011-07-27 06:17:02 +08:00
|
|
|
|
|
|
|
int* foo6(int** a, int*** b) {
|
|
|
|
return __sync_lock_test_and_set (a, b);
|
|
|
|
}
|
2020-12-31 12:45:56 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} i32* @foo6
|
2021-02-12 06:33:43 +08:00
|
|
|
// CHECK: atomicrmw xchg {{.*}}, align 8
|