1 // RUN: %clangxx_tsan %s -o %t 2 // RUN: %run %t 2>&1 | FileCheck %s 3 4 #include "bench.h" 5 6 int *x; 7 const int kStride = 32; 8 thread(int tid)9void thread(int tid) { 10 __atomic_load_n(&x[tid * kStride], __ATOMIC_ACQUIRE); 11 for (int i = 0; i < bench_niter; i++) 12 __atomic_store_n(&x[tid * kStride], 0, __ATOMIC_RELEASE); 13 } 14 bench()15void bench() { 16 x = (int*)malloc(bench_nthread * kStride * sizeof(x[0])); 17 for (int i = 0; i < bench_nthread; i++) 18 __atomic_store_n(&x[i * kStride], 0, __ATOMIC_RELEASE); 19 start_thread_group(bench_nthread, thread); 20 } 21 22 // CHECK: DONE 23 24