ADT
        arm-eh
        ast-experimental
        cleanup-dtors
        enum
        forall-pointer-decay
        jacob/cs343-translation
        jenkins-sandbox
        new-ast
        new-ast-unique-expr
        pthread-emulation
        qualifiedEnum
      
      
        
          | 
            Last change
 on this file since e63326b was             54db6ba, checked in by Thierry Delisle <tdelisle@…>, 6 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 | 
 | 
|---|
| 8 | thread_local volatile bool value;
 | 
|---|
| 9 | 
 | 
|---|
| 10 | void __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 | 
 | 
|---|
| 18 | int 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.