1 // RUN: tco %s | FileCheck %s
3 // CHECK: @x({{.*}} %[[ADDR:.*]])
4 func.func @x(%addr : !fir.ref<!fir.array<10x10xi32>>) -> index {
5 %c0 = arith.constant 0 : index
6 %c10 = arith.constant 10 : index
7 %c1 = arith.constant 1 : index
8 // CHECK-DAG: %[[R:.*]] = phi i64 {{.*}} [ 0,
9 // CHECK-DAG: %[[ROW:.*]] = phi i64 {{.*}} [ 11,
10 // CHECK: icmp sgt i64 %[[ROW]], 0
11 fir.do_loop %iv = %c0 to %c10 step %c1 {
12 // CHECK-DAG: %[[C:.*]] = phi i64 {{.*}} [ 0,
13 // CHECK-DAG: %[[COL:.*]] = phi i64 {{.*}} [ 11,
14 // CHECK: icmp sgt i64 %[[COL]], 0
15 fir.do_loop %jv = %c0 to %c10 step %c1 {
16 // CHECK: getelementptr {{.*}} %[[ADDR]], i32 0, i64 %[[R]], i64 %[[C]]
17 %ptr = fir.coordinate_of %addr, %jv, %iv : (!fir.ref<!fir.array<10x10xi32>>, index, index) -> !fir.ref<i32>
18 %c22 = arith.constant 22 : i32
19 // CHECK: store i32 22,
20 fir.store %c22 to %ptr : !fir.ref<i32>