xref: /llvm-project/openmp/runtime/test/ompt/synchronization/flush.c (revision 4df80bda4057cd242d40364ea6aa9aaa1f0fb69f)
1 // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s
2 // REQUIRES: ompt
3 // GCC generates code that does not call the runtime for the flush construct
4 // XFAIL: gcc
5 
6 #include "callback.h"
7 #include <omp.h>
8 
main()9 int main() {
10 #pragma omp parallel num_threads(2)
11   {
12     int tid = omp_get_thread_num();
13 
14 #pragma omp flush
15     print_current_address(1);
16   }
17 
18   return 0;
19 }
20 // Check if libomp supports the callbacks for this test.
21 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_flush'
22 
23 // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
24 // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_flush:
25 // CHECK-SAME: codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]
26 // CHECK: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]]
27 //
28 // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_flush:
29 // CHECK-SAME: codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]
30 // CHECK: {{^}}[[THREAD_ID]]: current_address={{.*}}[[RETURN_ADDRESS]]
31