[clangd] Re-land "support outgoing calls in call hierarchy" (#117673)
[llvm-project.git] / flang / test / Semantics / OpenMP / requires-atomic01.f90
blobae9fd086015dd46abe8891bf4f1c3c479bef6d89
1 ! RUN: %flang_fc1 -fopenmp -fopenmp-version=50 -fdebug-dump-parse-tree %s 2>&1 | FileCheck %s
2 ! Ensure that requires atomic_default_mem_order is used to update atomic
3 ! operations with no explicit memory order set.
4 program requires
5 implicit none
6 !$omp requires atomic_default_mem_order(seq_cst)
7 integer :: i, j
9 ! ----------------------------------------------------------------------------
10 ! READ
11 ! ----------------------------------------------------------------------------
13 ! CHECK-LABEL: OpenMPAtomicConstruct -> OmpAtomicRead
14 ! CHECK: OmpMemoryOrderClause -> OmpClause -> SeqCst
15 !$omp atomic read
16 i = j
18 ! CHECK-LABEL: OpenMPAtomicConstruct -> OmpAtomicRead
19 ! CHECK-NOT: OmpMemoryOrderClause -> OmpClause -> SeqCst
20 ! CHECK: OmpMemoryOrderClause -> OmpClause -> Relaxed
21 !$omp atomic relaxed read
22 i = j
24 ! CHECK-LABEL: OpenMPAtomicConstruct -> OmpAtomicRead
25 ! CHECK-NOT: OmpMemoryOrderClause -> OmpClause -> SeqCst
26 ! CHECK: OmpMemoryOrderClause -> OmpClause -> Relaxed
27 !$omp atomic read relaxed
28 i = j
30 ! ----------------------------------------------------------------------------
31 ! WRITE
32 ! ----------------------------------------------------------------------------
34 ! CHECK-LABEL: OpenMPAtomicConstruct -> OmpAtomicWrite
35 ! CHECK: OmpMemoryOrderClause -> OmpClause -> SeqCst
36 !$omp atomic write
37 i = j
39 ! CHECK-LABEL: OpenMPAtomicConstruct -> OmpAtomicWrite
40 ! CHECK-NOT: OmpMemoryOrderClause -> OmpClause -> SeqCst
41 ! CHECK: OmpMemoryOrderClause -> OmpClause -> Relaxed
42 !$omp atomic relaxed write
43 i = j
45 ! CHECK-LABEL: OpenMPAtomicConstruct -> OmpAtomicWrite
46 ! CHECK-NOT: OmpMemoryOrderClause -> OmpClause -> SeqCst
47 ! CHECK: OmpMemoryOrderClause -> OmpClause -> Relaxed
48 !$omp atomic write relaxed
49 i = j
51 ! ----------------------------------------------------------------------------
52 ! UPDATE
53 ! ----------------------------------------------------------------------------
55 ! CHECK-LABEL: OpenMPAtomicConstruct -> OmpAtomicUpdate
56 ! CHECK: OmpMemoryOrderClause -> OmpClause -> SeqCst
57 !$omp atomic update
58 i = i + j
60 ! CHECK-LABEL: OpenMPAtomicConstruct -> OmpAtomicUpdate
61 ! CHECK-NOT: OmpMemoryOrderClause -> OmpClause -> SeqCst
62 ! CHECK: OmpMemoryOrderClause -> OmpClause -> Relaxed
63 !$omp atomic relaxed update
64 i = i + j
66 ! CHECK-LABEL: OpenMPAtomicConstruct -> OmpAtomicUpdate
67 ! CHECK-NOT: OmpMemoryOrderClause -> OmpClause -> SeqCst
68 ! CHECK: OmpMemoryOrderClause -> OmpClause -> Relaxed
69 !$omp atomic update relaxed
70 i = i + j
72 ! CHECK-LABEL: OpenMPAtomicConstruct -> OmpAtomic
73 ! CHECK: OmpMemoryOrderClause -> OmpClause -> SeqCst
74 !$omp atomic
75 i = i + j
77 ! CHECK-LABEL: OpenMPAtomicConstruct -> OmpAtomic
78 ! CHECK-NOT: OmpMemoryOrderClause -> OmpClause -> SeqCst
79 ! CHECK: OmpMemoryOrderClause -> OmpClause -> Relaxed
80 !$omp atomic relaxed
81 i = i + j
83 ! ----------------------------------------------------------------------------
84 ! CAPTURE
85 ! ----------------------------------------------------------------------------
87 ! CHECK-LABEL: OpenMPAtomicConstruct -> OmpAtomicCapture
88 ! CHECK: OmpMemoryOrderClause -> OmpClause -> SeqCst
89 !$omp atomic capture
90 i = j
91 j = j + 1
92 !$omp end atomic
94 ! CHECK-LABEL: OpenMPAtomicConstruct -> OmpAtomicCapture
95 ! CHECK-NOT: OmpMemoryOrderClause -> OmpClause -> SeqCst
96 ! CHECK: OmpMemoryOrderClause -> OmpClause -> Relaxed
97 !$omp atomic relaxed capture
98 i = j
99 j = j + 1
100 !$omp end atomic
102 ! CHECK-LABEL: OpenMPAtomicConstruct -> OmpAtomicCapture
103 ! CHECK-NOT: OmpMemoryOrderClause -> OmpClause -> SeqCst
104 ! CHECK: OmpMemoryOrderClause -> OmpClause -> Relaxed
105 !$omp atomic capture relaxed
106 i = j
107 j = j + 1
108 !$omp end atomic
109 end program requires