Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Lower / forall / array-subscripts.f90
blob9fc721db4f60bda8cc9132ee74bc5be1f24b70d7
1 ! RUN: bbc -emit-fir %s -o - | FileCheck %s
3 ! Make sure we use array values for subscripts that are arrays on the lhs so
4 ! that copy-in/copy-out works correctly.
5 integer :: a(4,4)
6 forall(i=1:4,j=1:4)
7 a(a(i,j),a(j,i)) = j - i*100
8 end forall
9 end
11 ! CHECK-LABEL: func @_QQmain
12 ! CHECK: %[[a:.*]] = fir.address_of(@_QFEa) : !fir.ref<!fir.array<4x4xi32>>
13 ! CHECK: %[[a1:.*]] = fir.array_load %[[a]](%{{.*}}) : (!fir.ref<!fir.array<4x4xi32>>, !fir.shape<2>) -> !fir.array<4x4xi32>
14 ! CHECK: %[[a2:.*]] = fir.array_load %[[a]](%{{.*}}) : (!fir.ref<!fir.array<4x4xi32>>, !fir.shape<2>) -> !fir.array<4x4xi32>
15 ! CHECK: %[[a3:.*]] = fir.array_load %[[a]](%{{.*}}) : (!fir.ref<!fir.array<4x4xi32>>, !fir.shape<2>) -> !fir.array<4x4xi32>
16 ! CHECK: %[[av:.*]] = fir.do_loop
17 ! CHECK: fir.do_loop
18 ! CHECK: = fir.array_fetch %[[a2]], %{{.*}}, %{{.*}} : (!fir.array<4x4xi32>, index, index) -> i32
19 ! CHECK: = fir.array_fetch %[[a3]], %{{.*}}, %{{.*}} : (!fir.array<4x4xi32>, index, index) -> i32
20 ! CHECK: = fir.array_update %{{.*}}, %{{.*}}, %{{.*}} : (!fir.array<4x4xi32>, i32, index, index) -> !fir.array<4x4xi32>
21 ! CHECK : fir.array_merge_store %[[a1]], %[[av]] to %[[a]] : !fir.array<4x4xi32>, !fir.array<4x4xi32>, !fir.ref<!fir.array<4x4xi32>>