1 // RUN: %libomp-compile-and-run
3 // The test checks the teams construct with reduction executed on the host.
18 // Internal library stuff to emulate compiler's code generation:
31 static ident_t dummy_loc
= {0, 2, 0, 0, ";dummyFile;dummyFunc;0;0;;"};
34 // The global will be used as pointer, so we need to make sure that the
35 // compiler correctly aligns the global...
39 kmp_critical_name crit
;
41 int32_t __kmpc_global_thread_num(ident_t
*);
42 void __kmpc_push_num_teams(ident_t
*, int32_t global_tid
, int32_t num_teams
,
44 void __kmpc_fork_teams(ident_t
*, int32_t argc
, void *microtask
, ...);
45 int32_t __kmpc_reduce(ident_t
*, int32_t global_tid
, int32_t num_vars
,
46 size_t reduce_size
, void *reduce_data
, void *reduce_func
,
47 kmp_critical_name
*lck
);
48 void __kmpc_end_reduce(ident_t
*, int32_t global_tid
, kmp_critical_name
*lck
);
54 // Outlined entry point:
55 void outlined(int32_t *gtid
, int32_t *tid
) {
56 int32_t ret
= __kmpc_reduce(&dummy_loc
, *gtid
, 0, 0, NULL
, NULL
, &crit
);
57 __kmpc_end_reduce(&dummy_loc
, *gtid
, &crit
);
61 int32_t th
= __kmpc_global_thread_num(NULL
); // registers initial thread
62 __kmpc_push_num_teams(&dummy_loc
, th
, N_TEAMS
, N_THR
);
63 __kmpc_fork_teams(&dummy_loc
, 0, &outlined
);
65 // Test did not hang -> passed!