Mercurial > hg > CbC > CbC_llvm
comparison compiler-rt/test/tsan/bench_single_writer.cpp @ 150:1d019706d866
LLVM10
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 15:10:13 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
147:c2174574ed3a | 150:1d019706d866 |
---|---|
1 // RUN: %clangxx_tsan %s -o %t | |
2 // RUN: %run %t 2>&1 | FileCheck %s | |
3 | |
4 // bench.h needs pthread barriers which are not available on OS X | |
5 // UNSUPPORTED: darwin | |
6 | |
7 #include "bench.h" | |
8 | |
9 int x; | |
10 | |
11 void thread(int tid) { | |
12 if (tid == 0) { | |
13 for (int i = 0; i < bench_niter; i++) | |
14 __atomic_store_n(&x, 0, __ATOMIC_RELEASE); | |
15 } else { | |
16 for (int i = 0; i < bench_niter; i++) | |
17 __atomic_load_n(&x, __ATOMIC_ACQUIRE); | |
18 } | |
19 } | |
20 | |
21 void bench() { | |
22 start_thread_group(bench_nthread, thread); | |
23 } | |
24 | |
25 // CHECK: DONE | |
26 |