llvm-project
25 строк · 958.0 Байт
1// RUN: tco %s | FileCheck %s
2
3// CHECK: @x({{.*}} %[[ADDR:.*]])
4func.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
11fir.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
15fir.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,
20fir.store %c22 to %ptr : !fir.ref<i32>
21}
22}
23// CHECK: ret i64 10
24return %c10 : index
25}
26