[clangd] Re-land "support outgoing calls in call hierarchy" (#117673)
[llvm-project.git] / flang / test / Semantics / OpenMP / requires-atomic02.f90
blob4976a9667eb78f6b9b7510d52426403126de854f
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. ACQ_REL clause tested here.
4 program requires
5 implicit none
6 !$omp requires atomic_default_mem_order(acq_rel)
7 integer :: i, j
9 ! ----------------------------------------------------------------------------
10 ! READ
11 ! ----------------------------------------------------------------------------
13 ! CHECK-LABEL: OpenMPAtomicConstruct -> OmpAtomicRead
14 ! CHECK: OmpMemoryOrderClause -> OmpClause -> Acquire
15 !$omp atomic read
16 i = j
18 ! CHECK-LABEL: OpenMPAtomicConstruct -> OmpAtomicRead
19 ! CHECK-NOT: OmpMemoryOrderClause -> OmpClause -> Acquire
20 ! CHECK: OmpMemoryOrderClause -> OmpClause -> Relaxed
21 !$omp atomic relaxed read
22 i = j
24 ! CHECK-LABEL: OpenMPAtomicConstruct -> OmpAtomicRead
25 ! CHECK-NOT: OmpMemoryOrderClause -> OmpClause -> Acquire
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 -> Release
36 !$omp atomic write
37 i = j
39 ! CHECK-LABEL: OpenMPAtomicConstruct -> OmpAtomicWrite
40 ! CHECK-NOT: OmpMemoryOrderClause -> OmpClause -> Release
41 ! CHECK: OmpMemoryOrderClause -> OmpClause -> Relaxed
42 !$omp atomic relaxed write
43 i = j
45 ! CHECK-LABEL: OpenMPAtomicConstruct -> OmpAtomicWrite
46 ! CHECK-NOT: OmpMemoryOrderClause -> OmpClause -> Release
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 -> Release
57 !$omp atomic update
58 i = i + j
60 ! CHECK-LABEL: OpenMPAtomicConstruct -> OmpAtomicUpdate
61 ! CHECK-NOT: OmpMemoryOrderClause -> OmpClause -> Release
62 ! CHECK: OmpMemoryOrderClause -> OmpClause -> Relaxed
63 !$omp atomic relaxed update
64 i = i + j
66 ! CHECK-LABEL: OpenMPAtomicConstruct -> OmpAtomicUpdate
67 ! CHECK-NOT: OmpMemoryOrderClause -> OmpClause -> Release
68 ! CHECK: OmpMemoryOrderClause -> OmpClause -> Relaxed
69 !$omp atomic update relaxed
70 i = i + j
72 ! CHECK-LABEL: OpenMPAtomicConstruct -> OmpAtomic
73 ! CHECK: OmpMemoryOrderClause -> OmpClause -> Release
74 !$omp atomic
75 i = i + j
77 ! CHECK-LABEL: OpenMPAtomicConstruct -> OmpAtomic
78 ! CHECK-NOT: OmpMemoryOrderClause -> OmpClause -> Release
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 -> AcqRel
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 -> AcqRel
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 -> AcqRel
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