blob: a9630c815fc42482766e398286d087c29f00aacc [file] [log] [blame]
Valentin Clement7dc492e2022-04-04 07:25:281// RUN: tco %s | FileCheck %s
Andrzej Warzynskicc3c6b62022-06-01 16:00:312// RUN: %flang_fc1 -emit-llvm %s -o - | FileCheck %s
Valentin Clement7dc492e2022-04-04 07:25:283
Nikita Popove3bfd7e2022-06-02 09:53:004// CHECK-LABEL: define void @x(ptr %0)
River Riddlea83080202022-04-21 04:39:225func.func @x(%arr : !fir.ref<!fir.array<10xf32>>) {
Valentin Clement7dc492e2022-04-04 07:25:286 %1 = arith.constant 0 : index
7 %2 = arith.constant 9 : index
8 %stepvar = arith.constant 1 : index
9 // CHECK: alloca [10 x float], i64 1
10 %a = fir.alloca !fir.array<10xf32>
11 fir.do_loop %iv = %1 to %2 step %stepvar unordered {
12 %3 = fir.coordinate_of %arr, %iv : (!fir.ref<!fir.array<10xf32>>, index) -> !fir.ref<f32>
Nikita Popove3bfd7e2022-06-02 09:53:0013 // CHECK: %[[reg10:.*]] = load float, ptr
Valentin Clement7dc492e2022-04-04 07:25:2814 %4 = fir.load %3 : !fir.ref<f32>
Nikita Popove3bfd7e2022-06-02 09:53:0015 // CHECK: %[[reg11:.*]] = getelementptr [10 x float], ptr
Valentin Clement7dc492e2022-04-04 07:25:2816 %5 = fir.coordinate_of %a, %iv : (!fir.ref<!fir.array<10xf32>>, index) -> !fir.ref<f32>
Nikita Popove3bfd7e2022-06-02 09:53:0017 // CHECK: store float %[[reg10]], ptr %[[reg11]]
Valentin Clement7dc492e2022-04-04 07:25:2818 fir.store %4 to %5 : !fir.ref<f32>
19 }
20 %6 = fir.embox %a : (!fir.ref<!fir.array<10xf32>>) -> !fir.box<!fir.array<10xf32>>
21 fir.call @y(%6) : (!fir.box<!fir.array<10xf32>>) -> ()
22 return
23}
24
River Riddlea83080202022-04-21 04:39:2225func.func private @y(!fir.box<!fir.array<10xf32>>) -> ()