182e94a59SJoachim Protze // RUN: %libomp-compile-and-run | %sort-threads | 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 int x = 0;
1082e94a59SJoachim Protze #pragma omp parallel num_threads(2)
1182e94a59SJoachim Protze {
1282e94a59SJoachim Protze #pragma omp master
1382e94a59SJoachim Protze {
1482e94a59SJoachim Protze #pragma omp task
1582e94a59SJoachim Protze {
1682e94a59SJoachim Protze x++;
1782e94a59SJoachim Protze }
1882e94a59SJoachim Protze #pragma omp taskwait
1982e94a59SJoachim Protze print_current_address(1);
2082e94a59SJoachim Protze }
2182e94a59SJoachim Protze }
2282e94a59SJoachim Protze
2382e94a59SJoachim Protze // Check if libomp supports the callbacks for this test.
2482e94a59SJoachim Protze // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_sync_region'
2582e94a59SJoachim Protze // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_sync_region_wait'
2682e94a59SJoachim Protze
2782e94a59SJoachim Protze // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
2882e94a59SJoachim Protze
2982e94a59SJoachim Protze // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_taskwait_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]
3082e94a59SJoachim Protze // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_taskwait_begin: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS]]
3182e94a59SJoachim Protze // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_taskwait_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS]]
3282e94a59SJoachim Protze // CHECK-NEXT: {{^}}[[MASTER_ID]]: ompt_event_taskwait_end: parallel_id={{[0-9]+}}, task_id={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS]]
3382e94a59SJoachim Protze // CHECK-NEXT: {{^}}[[MASTER_ID]]: current_address={{.*}}[[RETURN_ADDRESS]]
3482e94a59SJoachim Protze
3582e94a59SJoachim Protze return 0;
3682e94a59SJoachim Protze }
37