xref: /llvm-project/openmp/runtime/test/ompt/synchronization/ordered.c (revision 633bc4ca994c876def0f5d9b1c81d6c785098054)
182e94a59SJoachim Protze // RUN: %libomp-compile-and-run | FileCheck %s
282e94a59SJoachim Protze // REQUIRES: ompt
3*633bc4caSJoachim Protze // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7
482e94a59SJoachim Protze #include "callback.h"
582e94a59SJoachim Protze #include <omp.h>
682e94a59SJoachim Protze 
main()782e94a59SJoachim Protze int main()
882e94a59SJoachim Protze {
982e94a59SJoachim Protze   #pragma omp ordered
1082e94a59SJoachim Protze   {
1182e94a59SJoachim Protze     print_current_address(1);
1282e94a59SJoachim Protze     print_ids(0);
1382e94a59SJoachim Protze   }
1482e94a59SJoachim Protze   print_current_address(2);
1582e94a59SJoachim Protze 
1682e94a59SJoachim Protze 
1782e94a59SJoachim Protze   // Check if libomp supports the callbacks for this test.
1882e94a59SJoachim Protze   // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquire'
1982e94a59SJoachim Protze   // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquired'
2082e94a59SJoachim Protze   // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_released'
2182e94a59SJoachim Protze   // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_nest_lock'
2282e94a59SJoachim Protze 
2382e94a59SJoachim Protze   // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
2482e94a59SJoachim Protze 
2582e94a59SJoachim Protze   // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_wait_ordered: wait_id=[[WAIT_ID:[0-9]+]], hint={{[0-9]+}}, impl={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]
2682e94a59SJoachim Protze   // CHECK: {{^}}[[MASTER_ID]]: ompt_event_acquired_ordered: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS]]
2782e94a59SJoachim Protze   // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]]
2882e94a59SJoachim Protze   // CHECK: {{^}}[[MASTER_ID]]: ompt_event_release_ordered: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]
2982e94a59SJoachim Protze   // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]]
3082e94a59SJoachim Protze 
3182e94a59SJoachim Protze   return 0;
3282e94a59SJoachim Protze }
33