[RISCV][VLOPT] Add vector narrowing integer right shift instructions to isSupportedIn...
[llvm-project.git] / offload / test / api / ompx_sync.c
blobb71eba43f5537634be43051e08beccce71e2c105
1 // RUN: %libomptarget-compile-run-and-check-generic
3 #include <omp.h>
4 #include <ompx.h>
5 #include <stdio.h>
7 void foo(int device) {
8 int X;
9 // clang-format off
10 #pragma omp target teams map(from: X) device(device) thread_limit(2) num_teams(1)
11 #pragma omp parallel
12 // clang-format on
14 int tid = ompx_thread_id_x();
15 int bid = ompx_block_id_x();
16 if (tid == 1 && bid == 0) {
17 X = 42;
18 ompx_sync_block_divergent(3);
19 } else {
20 ompx_sync_block_divergent(1);
22 if (tid == 0 && bid == 0)
23 X++;
24 ompx_sync_block(ompx_seq_cst);
25 if (tid == 1 && bid == 0)
26 X++;
27 ompx_sync_block_acq_rel();
28 if (tid == 0 && bid == 0)
29 X++;
30 ompx_sync_block(ompx_release);
31 if (tid == 0 && bid == 0)
32 X++;
34 // CHECK: X: 46
35 // CHECK: X: 46
36 printf("X: %i\n", X);
39 int main() {
40 foo(omp_get_default_device());
41 foo(omp_get_initial_device());