source: benchmark/tls-fetch_add.c @ 093a5d7

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 093a5d7 was dc33b5b, checked in by Peter A. Buhr <pabuhr@…>, 5 years ago

update benchmarks and add benchmarks for qthreads

  • Property mode set to 100644
File size: 526 bytes
RevLine 
[7a8f5246]1#include <stdbool.h>
2#include <stdio.h>
3
4#include "bench.h"
5
6#define thread_local _Thread_local
7
[54db6ba]8thread_local volatile bool value;
[7a8f5246]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
[dc33b5b]26        printf("%g\n", result);
[7a8f5246]27}
Note: See TracBrowser for help on using the repository browser.