source: benchmark/tls-fetch_add.c @ 54db6ba

arm-ehcleanup-dtorsenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 54db6ba was 54db6ba, checked in by Thierry Delisle <tdelisle@…>, 4 years ago

Fixed old style tls declaration in benchmark

  • Property mode set to 100644
File size: 528 bytes
Line 
1#include <stdbool.h>
2#include <stdio.h>
3
4#include "bench.h"
5
6#define thread_local _Thread_local
7
8thread_local volatile bool value;
9
10void __attribute__((noinline)) do_call() {
11        __atomic_store_n( &value, true, __ATOMIC_RELAXED );
12        __atomic_signal_fence(__ATOMIC_ACQUIRE);
13        asm volatile ("");
14        __atomic_store_n( &value, false, __ATOMIC_RELAXED );
15        __atomic_signal_fence(__ATOMIC_RELEASE);
16}
17
18int main(int argc, char* argv[]) {
19        BENCH(
20                for (size_t i = 0; i < n; i++) {
21                        do_call();
22                },
23                result
24        )
25
26        printf("%llu\n", result);
27}
Note: See TracBrowser for help on using the repository browser.