The ability to specify alignment was recently added, and it's an important property which we should ensure is set as expected by Clang. (Especially before making further changes to Clang's code in this area.) But, because it's on the end of the lines, the existing tests all ignore it. Therefore, update all the tests to also verify the expected alignment for atomicrmw and cmpxchg. While I was in there, I also updated uses of 'load atomic' and 'store atomic', and added the memory ordering, where that was missing.
18 lines
484 B
C++
18 lines
484 B
C++
// RUN: %clang_cc1 %s -emit-llvm -o - -triple=i686-apple-darwin9 | FileCheck %s
|
|
|
|
namespace PR11411 {
|
|
template<typename _Tp> struct Ptr {
|
|
void f();
|
|
};
|
|
|
|
// CHECK-LABEL: define linkonce_odr void @_ZN7PR114113PtrIiE1fEv
|
|
// CHECK-NOT: ret
|
|
template<typename _Tp> inline void Ptr<_Tp>::f() {
|
|
int* _refcount;
|
|
// CHECK: atomicrmw add i32* {{.*}} seq_cst, align 4
|
|
__sync_fetch_and_add(_refcount, 1);
|
|
// CHECK-NEXT: ret void
|
|
}
|
|
void f(Ptr<int> *a) { a->f(); }
|
|
}
|