xref: /llvm-project/openmp/runtime/test/ompt/synchronization/flush.c (revision 4df80bda4057cd242d40364ea6aa9aaa1f0fb69f)
182e94a59SJoachim Protze // RUN: %libomp-compile-and-run | %sort-threads | FileCheck %s
282e94a59SJoachim Protze // REQUIRES: ompt
382e94a59SJoachim Protze // GCC generates code that does not call the runtime for the flush construct
482e94a59SJoachim Protze // XFAIL: gcc
582e94a59SJoachim Protze 
682e94a59SJoachim Protze #include "callback.h"
782e94a59SJoachim Protze #include <omp.h>
882e94a59SJoachim Protze 
main()9*4df80bdaSJoachim Protze int main() {
1082e94a59SJoachim Protze #pragma omp parallel num_threads(2)
1182e94a59SJoachim Protze   {
1282e94a59SJoachim Protze     int tid = omp_get_thread_num();
1382e94a59SJoachim Protze 
1482e94a59SJoachim Protze #pragma omp flush
1582e94a59SJoachim Protze     print_current_address(1);
1682e94a59SJoachim Protze   }
1782e94a59SJoachim Protze 
18*4df80bdaSJoachim Protze   return 0;
19*4df80bdaSJoachim Protze }
2082e94a59SJoachim Protze // Check if libomp supports the callbacks for this test.
2182e94a59SJoachim Protze // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_flush'
2282e94a59SJoachim Protze 
2382e94a59SJoachim Protze // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
24*4df80bdaSJoachim Protze // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_flush:
25*4df80bdaSJoachim Protze // CHECK-SAME: codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]
26*4df80bdaSJoachim Protze // CHECK: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]]
2782e94a59SJoachim Protze //
28*4df80bdaSJoachim Protze // CHECK: {{^}}[[THREAD_ID:[0-9]+]]: ompt_event_flush:
29*4df80bdaSJoachim Protze // CHECK-SAME: codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]
30*4df80bdaSJoachim Protze // CHECK: {{^}}[[THREAD_ID]]: current_address={{.*}}[[RETURN_ADDRESS]]
31